package com.jd.finance.oss;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.util.Arrays;

/**
 * @Author: LiQingBo
 * @Date: 2021/10/7-10-07-11:11
 * @Description: com.ddz.qpz.oss
 * @version: 1.0
 */
@Slf4j
@SpringBootApplication
@ComponentScan({"com.jd.finance"})
@EnableFeignClients
public class OssApplication {

    public static void main(String[] args) {
        try {
            SpringApplication.run(OssApplication.class, args);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx, Environment env) {
        return args -> {
            log.info("系统运行的配置:profile :{}", Arrays.toString(env.getActiveProfiles()));
            log.info("测试:{}", "http://127.0.0.1:" + env.getProperty("server.port")+env.getProperty("server.servlet.context-path")+"/doc.html");
        };
    }
}
